Macromedia Flex Article

Is Macromedia Flex the Right Fit for You?

David Wadhwani

Macromedia

Macromedia has been helping developers build Rich Internet Applications (RIAs) longer than just about anyone else: We began in the late 1990s with Macromedia Flash authoring. Through the years our vision has been clear and consistent: Better user experiences lead to measurable business gains. We've seen hotels increase their online reservations by over 80 percent and business-to-business commerce sites reduce errant orders and returns by almost 25 percent. Online retailers have seen fewer abandoned transactions during the checkout process and an increase in the effectiveness of upsell opportunities. What drives this? Satisfied end users: They love RIAs because they enhance their online experiences and simplify transactions.

If the built-in Flash authoring inherent in RIAs already satisfies end users and leads to increased return on investment, why do you need Macromedia Flex to build your applications? Flash authoring is a fully self-contained tool focused on designers and a certain class of visual developer. Though it has been very successful for this type of designer/developer, many midsize to large enterprise customers we talked to over the years provided us with a very clear mandate: They wanted to maintain the application expressiveness that their users demanded without compromising the existing investments they had made. In short, they needed a product that does the following:

  • Works with their existing technology infrastructure
  • Integrates with existing design, development, and deployment processes
  • Leverages existing employee skills

Armed with these clear requirements from our customers, we set off to build Macromedia Flex.

This article provides a high-level overview of Flex as it relates to these customer requirements. I describe the types of applications Flex 1.0 is best suited to build and share insight into some of the tradeoffs we made along the way.

Note: This article assumes some knowledge of Rich Internet Applications and a high-level understanding of Flex. You can find a good review of RIAs in Experience Matters, a presentation by Macromedia Chief Marketing Officer Al Ramadan, and a good overview of Flex in An Overview of MXML, the Macromedia Flex Markup Language by Flex Technical Evangelist Christophe Coenraets.

Listening to Customer Requirements

Macromedia Flex is a presentation server that runs in the context of a Java or .NET application server. It is comprised of four primary segments:

  • XML-based language called MXML that manages the visual elements of your application
  • Object-oriented programming language called ActionScript 2.0 that is based on the ECMAScript standard
  • Set of application components that embody many of the best practices Macromedia has observed in successful RIAs
  • Series of back-end services that simplify interaction with runtime tasks such as data management, business logic integration, and client-server communication

Put simply, Flex is RIA programming for traditional enterprise developers. It supports common design patterns, works with existing development and deployment technologies, and provides the benefits of a modern, standards-based language. The following sections describe some specific examples of how Flex addresses these customer requirements.

Working with Your Existing Infrastructure

Companies have invested millions of dollars building n-tier service-oriented architectures (SOAs) and require that any new solution integrate well with their SOA design. Many enterprises expose their services using one of three techniques:

  • XML over HTTP or HTTPS
  • Web services (SOAP)
  • Java objects

The Flex programming model allows developers to work cleanly with any of these techniques using just three service tags: <HTTPService>, <WebService>, or <RemoteObject>. Developers using the <HTTPService> tag simply specify the URL containing an XML document. Those using SOAP for data transport can use the <WebService> tag to communicate with remote web services by referencing the standard, associated WSDL (Web Service Definition Language format) file. Finally, developers who need to access server objects (such as Java objects) directly, that have not been explicitly exposed as a web service, can use the <RemoteObject> tag. Flex automatically manages the overhead of the data transport, object serialization, and deserialization and treats remote services as local objects.

At the same time Flex gives IT professionals the control they need to ensure they can deploy the application in a secure, maintainable fashion. The Flex service architecture references a security white list deployed on the server behind the enterprise firewall. System administrators can use this white list to restrict access to certain services based on user roles. They can also take advantage of support for named services. This gives the IT department greater flexibility as it updates its systems.

These are just a few examples of how developers and system administrators can use Flex comfortably without changing their infrastructure. For further information on integrating Flex into your existing systems, refer to these articles written by Christophe Coenraets—Using Named Services to Access Back-End Data and Providing a Flex Front End to Your Struts Applications. Also check up with Christophe's blog at www.markme.com/cc for an ongoing discussion of these and other issues.

Integrating with Existing Design, Development, and Deployment Processes

Many businesses live and die by the processes they rely on. They ensure the success of these processes by investing in the right technologies to support them and by training their employees to follow them. Flex fits cleanly into these processes because it was built with a commitment to standards. Macromedia is a member of ECMA, the Java Community Process, and W3C—and it shows in Flex:

  • MXML is XML-compliant
  • ActionScript 2.0 is based on the ECMA 262 Edition 4 scripting standard
  • CSS, the W3C styling standard, can be used for consistent control over the application's look and feel
  • SVG can be used to embed artwork
  • Major de facto standards can be consumed by Flex (GIF, PNG, SWF, and more)

Flex developers are not forced to use specific tools to create the right user experience. Because Flex provides a text-based language, it works seamlessly with your existing source control system, coding environments, and design tools. Likewise, you can integrate these same files into your deployment processes without any significant overhead. Therefore, if your company has successfully built and deployed HTML, CFML, JSP, or ASP-style applications, it can successfully build and deploy MXML-style applications with Macromedia Flex.

Leveraging Existing Employee Skills

Companies have invested heavily in training employees to work with actual and de facto standards. Many enterprises have created organizational structures that help increase efficiency based on these skills. Our customers want to leverage these skills and the resulting operational structures.

As such, Flex was designed to be familiar to JSP and ASP developers. We've seen developers with these backgrounds write their first Flex applications in minutes and write complex Flex applications in a matter of days. The languages are similar, even though the resulting MXML applications are much more expressive. Designers and developers can work as they always have (see Development Process and Designer/Developer Workflow by Christophe Coenraets and Case Study: The Development Life Cycle of a Flex Application by Sean Schnoor). Front-end and back-end developers leverage the skills they've fine-tuned over the last few years working with, for example, JSP and business-tier Java objects. Finally, development and IT organizations maintain the same relationship: They deploy and configure Flex applications in much the same way that they deploy and configure JSP or ASP applications.

In summary, Macromedia heard your requests and now helps you build Rich Internet Application that let you leverage your existing investments in your infrastructure, your processes, and your employees.

Targeting Applications for Flex 1.0

The Flex mission is broad and its implementation will span several years. For Version 1.0 we focused on areas where Rich Internet Applications have established a clear return on investment. Macromedia saw three categories of applications derive the most benefit from moving to a rich front end and designed Flex to focus on them: guided selling, self-service, and dashboard applications. This doesn't mean you should not use Flex to build other types of applications but because this is a Version 1.0 product, we want to ensure the success of customers working on certain classes of applications.

Guided Selling Applications

Rich Internet Applications that help customers find and purchase merchandise online have significantly increased the number of successful purchases overall. Single-screen, highly interactive product configurators that allow end users to visually create and inspect a product before purchasing it tend to result in more purchases and fewer returns. One-screen shopping carts, checkout processes, and upsell opportunities also dramatically increase end users' success when compared to the traditional HTML counterparts. Flex lets you easily implement the best practices that make rich commerce applications more effective.

Self-Service Applications

Broadly stated, self-service applications allow end users to accomplish a task online instead of calling a customer service representative. Organizations that employ online processes to serve customers or employees know that it is far more cost-effective to employ an online presence than a human resource. Flex allows you to develop single-screen applications that guide end users more naturally to complete multistep tasks than traditional HTML-based processes are able to do. With Flex, for example, you can turn a 20-page insurance claims process into a single-screen, highly-interactive experience that end users can use much more easily and with fewer errors.

Dashboard Applications

The Flash runtime provides a unique ability to present disparate pieces of information logically in a single dashboard format. It enables users to navigate to these individual pieces easily without losing their context. Flex supports this type of metaphor by showcasing a layout infrastructure and information containers called panels. By combining the layout mechanism and these panels with the built-in effects of Flex, end users can zoom in on specific areas of interest. Users are then easily able to see details for a single panel, view multiple panels to compare them, or drag and drop data between them. The powerful layout mechanisms of Flex combined with the unique interactive presentation capability of Flash Player allows developers to create data-rich, easily navigable, and highly interactive dashboard applications.

Other Projects

Although Flex 1.0 focuses on guided selling, customer self-service, and dashboard applications, the server still supports a wide range of general-purpose applications. We have seen developers successfully build Flex applications that don't map cleanly into one of these three areas. As with all technologies, we recommend that you carefully analyze the capabilities of Flex with your unique requirements. We also welcome suggestions for other specific types of applications that you think we should do more to support.

Going Beyond Flex 1.0

Because Flex is a Version 1.0 product, we had to make certain tradeoffs. In general, however, we were uncompromising when it came to two things:

  • Addressing customer desires to leverage existing investments in infrastructure, processes, and employee skills
  • Ensuring that customers could build great guided selling, customer self-service, and dashboard-style applications

We are confident in the ability of Flex to build terrific user experiences and scale with your deployment needs. In the interest of helping you make the right decision for your specific needs, however, I want to touch on a few of the tradeoffs we made in Flex 1.0 and clear up some of the common misperceptions we heard along the way. Watch for the following in future releases of Flex.

Runtime Shared Libraries

The Flex application model contains a rich set of visual and nonvisual components that developers can use to lay out user interface elements, apply visual effects based on user interaction, trigger client-side data validation, and implement other standard application patterns. As you might expect with any object-oriented language, developers can aggregate these components into composite components and separate them into multiple MXML and ActionScript files. This allows a team of developers to create and share custom components easily.

However, it is important to note that Flex 1.0 does not support runtime shared libraries. Any Flex components that an application references are statically compiled into the downloaded Flash application. A site can certainly have multiple applications but each will embed only the components it needs. However, Flex can dynamically load assets, and because both the Flex application and the dynamically loaded assets leverage the browser cache, they're rarely downloaded multiple times by the same user.

How does this affect the size of a Flex application? Macromedia has gone to great lengths to keep Flex application sizes small. Applications built with Flex 1.0 start around 100K; reasonably complex applications range anywhere between 180–250K. Larger application sizes can result depending on the amount of business logic the developer moves from the server to the Flex application.

Large Data Sets and Performance Tuning

As I mentioned earlier, Flex supports multiple ways to connect to your server-side business logic. In fact, a number of built-in capabilities help ensure good performance. For example, Flex converts XML data into local objects "just in time" to avoid paying an upfront penalty for data that the end user may never access.

However, it is important that you understand the performance profile of the technologies you use because Flex applications are a hybrid of traditional fat-client applications and web-deployed, server-only applications. As such, you need to design the application to optimize processing using both the client and the server. The Flash runtime is designed for UI presentation and to manage client state but it is not designed to manage massive amounts of data on the client. To handle large data sets, you should build support for data paging. See Matthew Chotin's blog (link TBD) for an ongoing discussion of Flex applications and data management. The design patterns that Matt suggests will help ensure good application performance and maintainable implementation practices.

Skinning Versus Styling

The experience design team at Macromedia has worked with many customers over the years. This team has iteratively defined a set of user interface guidelines and carefully designed a default look and feel for Flex applications. Developers are able to leverage this aesthetic or alter the look and feel as needed using our support for styles or skins. Styling is sufficient for most customer needs. Flex ships with a handful of sample Cascading Style Sheet (CSS) files. Figures 1–3 show an example of one application styled differently with only about 10 lines of CSS. Below each figure is the relevant CSS code. Notice what differs in each example:

  • Color schemes and gradients
  • Background images
  • Curves on panels that comprise the application
Default look for the Flex application; no CSS required

Figure 1. Default look for the Flex application; no CSS required

Flex application look based on autumn.css

Figure 2. Flex application look based on autumn.css

autumn.css:
global {
   font-family:"Trebuchet MS";
   font-size:11px;
   color:#000000;
   header-colors:#DEBD84,#F7DEB5;
   footer-colors:#F7DEB5,#DEBD84;
   corner-radius:10;
}

Application {
   themeColor:#FE8A4B;
   selectionColor:#EFDEC2;
   rollOverColor:#F9F2E7;
   backgroundImage:"backgrounds/autumn.swf";
   backgroundSize:"100%";
   backgroundColor:#854230;
}
Flex application based on institutional.css

Figure 3. Flex application based on institutional.css

institutional.css:
global {
   font-family:"Arial";
   font-size:11px;
   color:#0E1D2C;
   header-colors:#8BC0E7,#8BC0E7;
   footer-colors:#8BC0E7,#8BC0E7;
   corner-radius:4;
}

Application {
   themeColor:haloBlue;
   backgroundImage:"backgrounds/institutional.swf";
   backgroundSize:"100%";
   backgroundColor:#23476A;
}

In case this level of UI customization does not meet your needs, we provide a process for creating alternate skins associated with Flex components. Although you can get vastly different looks this way, it is not for the faint of heart. We recommend that you have an expert Flash designer do the work. The changes go beyond color gradient updates and background images; components are actually drawn differently. While this is a powerful concept for any company that wants to create highly branded Flex applications, most customers simply brand using CSS.

Not Necessarily Right for All Flash Developers

We designed Macromedia Flex to meet the needs of the traditional enterprise developer market–for instance, n-tier, JSP/Java, ASP/C# teams–but expect that a number of Flash developers will become familiar with it. It is important that these individuals not bring too many expectations to the table based on their experiences with Flash authoring or building smaller web applications. Flex is a server with enough horsepower to build very structured n-tier applications, using common design patterns such as the Model-View- Controller pattern. (See Architecting Flex Applications by Christophe Coenraets.)

Although of course we welcome new types of users to Flex, we understand that it is not for everyone. Those looking for a RAD tool or a designer-focused paradigm should consider Flash authoring. Those with traditional n-tier application development experience looking to build on their existing infrastructure and skills should consider Flex. In the end, we fully expect that Flash designers/developers and Flex developers will collaborate closely to create applications that revolutionize online experiences for all end users. (See Building Rich Internet Applications with Macromedia Flex: A Flash Perspective by Nigel Pegg.)

Flex 1.0 continues the commitment on the part of Macromedia to improve application effectiveness by enhancing end-user experiences. It empowers traditional enterprise developers to create robust, maintainable, and scalable Rich Internet Applications rapidly. We invite you to join us as we continue our journey and ask that you continue to provide us with detailed feedback that has brought us this far. We've listened to you in the past and will continue to do so in the future. This is just the beginning.


About the author

David Wadhwani is the senior director of product development for Macromedia Flex. Prior to joining Macromedia in 2002 he was the founder and vice president of product development at iHarvest Corporation. While at iHarvest, David led the development and deployment of a web-based knowledge management and collaboration system before selling it to Interwoven, Inc. He also spent approximately four years at Oracle in the early 1990s where he was part of the core team that conceived, designed, and implemented Oracle's first business analytics software package. David is a graduate of Brown University and a member of The Indus Entrepreneurs, and has advised a number of software startups over the last five years.